home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg2.cab / ooo2wordml_settings.xsl < prev    next >
Extensible Markup Language  |  2005-09-10  |  18KB  |  321 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.     OpenOffice.org - a multi-platform office productivity suite
  5.  
  6.     $RCSfile: ooo2wordml_settings.xsl,v $
  7.  
  8.     $Revision: 1.8 $
  9.  
  10.     last change: $Author: rt $ $Date: 2005/09/08 22:07:26 $
  11.  
  12.     The Contents of this file are made available subject to
  13.     the terms of GNU Lesser General Public License Version 2.1.
  14.  
  15.  
  16.       GNU Lesser General Public License Version 2.1
  17.       =============================================
  18.       Copyright 2005 by Sun Microsystems, Inc.
  19.       901 San Antonio Road, Palo Alto, CA 94303, USA
  20.  
  21.       This library is free software; you can redistribute it and/or
  22.       modify it under the terms of the GNU Lesser General Public
  23.       License version 2.1, as published by the Free Software Foundation.
  24.  
  25.       This library is distributed in the hope that it will be useful,
  26.       but WITHOUT ANY WARRANTY; without even the implied warranty of
  27.       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  28.       Lesser General Public License for more details.
  29.  
  30.       You should have received a copy of the GNU Lesser General Public
  31.       License along with this library; if not, write to the Free Software
  32.       Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  33.       MA  02111-1307  USA
  34.  
  35. -->
  36. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" exclude-result-prefixes="office table style text draw svg   dc config xlink meta oooc dom ooo chart math dr3d form script ooow draw">
  37.     <xsl:template match="office:settings">
  38.         <w:docPr>
  39.             <w:displayBackgroundShape/>
  40.             <xsl:variable name="view-settings" select="config:config-item-set[@config:name = 'view-settings']"/>
  41.             <xsl:choose>
  42.                 <xsl:when test="$view-settings/config:config-item[@config:name = 'InBrowseMode'] = 'true'">
  43.                     <w:view w:val="outline"/>
  44.                 </xsl:when>
  45.                 <xsl:otherwise>
  46.                     <w:view w:val="print"/>
  47.                 </xsl:otherwise>
  48.             </xsl:choose>
  49.             <xsl:variable name="views" select="$view-settings/config:config-item-map-indexed[@config:name = 'Views']"/>
  50.             <w:zoom w:percent="{$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomFactor']}">
  51.                 <xsl:variable name="zoom-type" select="$views/config:config-item-map-entry/config:config-item[@config:name = 'ZoomType']"/>
  52.                 <xsl:choose>
  53.                     <xsl:when test="$zoom-type = '3'">
  54.                         <xsl:attribute name="w:val">best-fit</xsl:attribute>
  55.                     </xsl:when>
  56.                     <xsl:when test="$zoom-type = '2'">
  57.                         <xsl:attribute name="w:val">full-page</xsl:attribute>
  58.                     </xsl:when>
  59.                     <xsl:when test="$zoom-type = '1'">
  60.                         <xsl:attribute name="w:val">text-fit</xsl:attribute>
  61.                     </xsl:when>
  62.                 </xsl:choose>
  63.             </w:zoom>
  64.             <w:defaultTabStop>
  65.                 <xsl:attribute name="w:val"><xsl:call-template name="convert2twip"><xsl:with-param name="value" select="/office:document/office:styles/style:default-style[@style:family='paragraph']/style:paragraph-properties/@style:tab-stop-distance"/></xsl:call-template></xsl:attribute>
  66.             </w:defaultTabStop>
  67.             <xsl:if test="../office:master-styles/style:master-page/style:header-left">
  68.                 <w:evenAndOddHeaders/>
  69.             </xsl:if>
  70.             <xsl:apply-templates select="/office:document/office:styles/text:footnotes-configuration"/>
  71.             <xsl:apply-templates select="/office:document/office:styles/text:endnotes-configuration"/>
  72.             <!-- add the variables declaration in w:docpr G.Y.  Begin-->
  73.             <xsl:if test="/office:document/office:body/office:text/text:variable-decls | /office:document/office:body/office:text/text:user-field-decls |/office:document/office:body/office:text/text:sequence-decls ">
  74.                 <xsl:call-template name="field_declare">
  75.                     <xsl:with-param name="simple_field_variable_declares" select="/office:document/office:body/office:text/text:variable-decls"/>
  76.                     <xsl:with-param name="user_field_variable_declares" select=" /office:document/office:body/office:text/text:user-field-decls"/>
  77.                     <xsl:with-param name="field_sequence_declares" select="/office:document/office:body/office:text/text:sequence-decls"/>
  78.                 </xsl:call-template>
  79.             </xsl:if>
  80.             <!--add the variables declaration in w:docpr  G.Y. End-->
  81.         </w:docPr>
  82.     </xsl:template>
  83.     <xsl:template match="text:footnotes-configuration">
  84.         <xsl:param name="within-section"/>
  85.         <w:footnotePr>
  86.             <xsl:choose>
  87.                 <xsl:when test="@text:footnotes-position = 'document'">
  88.                     <w:pos w:val="beneath-text"/>
  89.                 </xsl:when>
  90.                 <xsl:otherwise>
  91.                     <w:pos w:val="page-bottom"/>
  92.                 </xsl:otherwise>
  93.             </xsl:choose>
  94.             <xsl:if test="@text:start-value">
  95.                 <w:numStart w:val="{@text:start-value + 1}"/>
  96.             </xsl:if>
  97.             <xsl:if test="@style:num-format">
  98.                 <xsl:call-template name="convert-number-format">
  99.                     <xsl:with-param name="number-format" select="@style:num-format"/>
  100.                     <xsl:with-param name="number-prefix" select="@style:num-prefix"/>
  101.                     <xsl:with-param name="number-suffix" select="@style:num-suffix"/>
  102.                 </xsl:call-template>
  103.             </xsl:if>
  104.             <xsl:if test="@text:start-numbering-at">
  105.                 <xsl:choose>
  106.                     <xsl:when test="@text:start-numbering-at = 'document'">
  107.                         <w:numRestart w:val="continuous"/>
  108.                     </xsl:when>
  109.                     <xsl:when test="@text:start-numbering-at = 'page'">
  110.                         <w:numRestart w:val="each-page"/>
  111.                     </xsl:when>
  112.                     <!-- convert "chapter" to "section" -->
  113.                     <xsl:otherwise>
  114.                         <w:numRestart w:val="each-sect"/>
  115.                     </xsl:otherwise>
  116.                 </xsl:choose>
  117.             </xsl:if>
  118.             <xsl:if test="$within-section != 'yes'">
  119.                 <!-- because in SO/OOo footnote-sep is defined within every page-layout, but in Word XML footnote separator
  120.                 is defined solely in docPr, so not trouble to find the proper footnote-sep definition. -->
  121.                 <w:footnote w:type="separator">
  122.                     <w:p>
  123.                         <w:r>
  124.                             <w:separator/>
  125.                         </w:r>
  126.                     </w:p>
  127.                 </w:footnote>
  128.                 <w:footnote w:type="continuation-separator">
  129.                     <w:p>
  130.                         <w:r>
  131.                             <w:continuationSeparator/>
  132.                             <xsl:if test="text:footnote-continuation-notice-backward">
  133.                                 <w:t>
  134.                                     <xsl:value-of select="text:footnote-continuation-notice-backward"/>
  135.                                 </w:t>
  136.                             </xsl:if>
  137.                         </w:r>
  138.                     </w:p>
  139.                 </w:footnote>
  140.                 <xsl:if test="text:footnote-continuation-notice-forward">
  141.                     <w:footnote w:type="continuation-notice">
  142.                         <w:p>
  143.                             <w:r>
  144.                                 <w:t>
  145.                                     <xsl:value-of select="text:footnote-continuation-notice-forward"/>
  146.                                 </w:t>
  147.                             </w:r>
  148.                         </w:p>
  149.                     </w:footnote>
  150.                 </xsl:if>
  151.             </xsl:if>
  152.         </w:footnotePr>
  153.     </xsl:template>
  154.     <xsl:template match="text:endnotes-configuration">
  155.         <xsl:param name="within-section"/>
  156.         <w:endnotePr>
  157.             <w:pos w:val="sect-end"/>
  158.             <xsl:if test="@text:start-value">
  159.                 <w:numStart w:val="{@text:start-value + 1}"/>
  160.             </xsl:if>
  161.             <xsl:if test="@style:num-format">
  162.                 <xsl:call-template name="convert-number-format">
  163.                     <xsl:with-param name="number-format" select="@style:num-format"/>
  164.                     <xsl:with-param name="number-prefix" select="@style:num-prefix"/>
  165.                     <xsl:with-param name="number-suffix" select="@style:num-suffix"/>
  166.                 </xsl:call-template>
  167.             </xsl:if>
  168.             <w:numRestart w:val="each-sect"/>
  169.             <xsl:if test="$within-section != 'yes'">
  170.                 <w:endnote w:type="separator">
  171.                     <w:p>
  172.                         <w:r>
  173.                             <w:separator/>
  174.                         </w:r>
  175.                     </w:p>
  176.                 </w:endnote>
  177.                 <w:endnote w:type="continuation-separator">
  178.                     <w:p>
  179.                         <w:r>
  180.                             <w:continuationSeparator/>
  181.                         </w:r>
  182.                     </w:p>
  183.                 </w:endnote>
  184.             </xsl:if>
  185.         </w:endnotePr>
  186.     </xsl:template>
  187.     <xsl:template name="convert-number-format">
  188.         <xsl:param name="number-format"/>
  189.         <xsl:param name="number-prefix"/>
  190.         <xsl:param name="number-suffix"/>
  191.         <xsl:choose>
  192.             <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '0'">
  193.                 <w:numFmt w:val="decimal-zero"/>
  194.             </xsl:when>
  195.             <xsl:when test="$number-format = '1' and normalize-space($number-suffix) = '.'">
  196.                 <w:numFmt w:val="decimal-enclosed-fullstop"/>
  197.             </xsl:when>
  198.             <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '(' and normalize-space($number-prefix) = ')'">
  199.                 <w:numFmt w:val="decimal-enclosed-paren"/>
  200.             </xsl:when>
  201.             <xsl:when test="$number-format = '1' and normalize-space($number-prefix) = '-' and normalize-space($number-prefix) = '-'">
  202.                 <w:numFmt w:val="number-in-dash"/>
  203.             </xsl:when>
  204.             <xsl:when test="$number-format = '1'">
  205.                 <!-- '1' also seems: decimal-half-width -->
  206.                 <w:numFmt w:val="decimal"/>
  207.             </xsl:when>
  208.             <xsl:when test="$number-format = 'a'">
  209.                 <w:numFmt w:val="lower-letter"/>
  210.             </xsl:when>
  211.             <xsl:when test="$number-format = 'A'">
  212.                 <w:numFmt w:val="upper-letter"/>
  213.             </xsl:when>
  214.             <xsl:when test="$number-format = 'i'">
  215.                 <w:numFmt w:val="lower-roman"/>
  216.             </xsl:when>
  217.             <xsl:when test="$number-format = 'I'">
  218.                 <w:numFmt w:val="upper-roman"/>
  219.             </xsl:when>
  220.             <xsl:when test="$number-format = '∩╝æ, ∩╝Æ, ∩╝ô, ...'">
  221.                 <!-- '∩╝æ, ∩╝Æ, ∩╝ô, ...' also seems: decimal-full-width2 -->
  222.                 <w:numFmt w:val="decimal-full-width"/>
  223.             </xsl:when>
  224.             <xsl:when test="$number-format = 'Γæá, Γæí, Γæó, ...'">
  225.                 <!-- decimal-enclosed-circle seems same -->
  226.                 <w:numFmt w:val="decimal-enclosed-circle-chinese"/>
  227.             </xsl:when>
  228.             <xsl:when test="$number-format = 'Σ╕Ç, Σ║î, Σ╕ë, ...' and normalize-space($number-prefix) = '(' and normalize-space($number-suffix) = ')'">
  229.                 <w:numFmt w:val="ideograph-enclosed-circle"/>
  230.             </xsl:when>
  231.             <xsl:when test="$number-format = 'Σ╕Ç, Σ║î, Σ╕ë, ...'">
  232.                 <!-- 'Σ╕Ç, Σ║î, Σ╕ë, ...' also seems: ideograph-digital, japanese-counting, japanese-digital-ten-thousand,
  233.                 taiwanese-counting, taiwanese-counting-thousand, taiwanese-digital, chinese-counting, korean-digital2 -->
  234.                 <w:numFmt w:val="chinese-counting-thousand"/>
  235.             </xsl:when>
  236.             <xsl:when test="$number-format = 'σú╣, Φ┤░, σÅü, ...'">
  237.                 <w:numFmt w:val="chinese-legal-simplified"/>
  238.             </xsl:when>
  239.             <xsl:when test="$number-format = 'σú╣, Φ▓│, σÅâ, ...'">
  240.                 <w:numFmt w:val="ideograph-legal-traditional"/>
  241.             </xsl:when>
  242.             <xsl:when test="$number-format = 'τö▓, Σ╣Ö, Σ╕Ö, ...'">
  243.                 <w:numFmt w:val="ideograph-traditional"/>
  244.             </xsl:when>
  245.             <xsl:when test="$number-format = 'σ¡É, Σ╕æ, σ»à, ...'">
  246.                 <w:numFmt w:val="ideograph-zodiac"/>
  247.             </xsl:when>
  248.             <xsl:when test="$number-format = 'σú▒, σ╝É, σÅé, ...'">
  249.                 <w:numFmt w:val="japanese-legal"/>
  250.             </xsl:when>
  251.             <xsl:when test="$number-format = 'πéó, πéñ, πéª, ...'">
  252.                 <w:numFmt w:val="aiueo-full-width"/>
  253.             </xsl:when>
  254.             <xsl:when test="$number-format = '∩╜▒, ∩╜▓, ∩╜│, ...'">
  255.                 <w:numFmt w:val="aiueo"/>
  256.             </xsl:when>
  257.             <xsl:when test="$number-format = 'πéñ, πâ¡, πâÅ, ...'">
  258.                 <w:numFmt w:val="iroha-full-width"/>
  259.             </xsl:when>
  260.             <xsl:when test="$number-format = '∩╜▓, ∩╛¢, ∩╛è, ...'">
  261.                 <w:numFmt w:val="iroha"/>
  262.             </xsl:when>
  263.             <xsl:when test="$number-format = '∞¥╝, ∞¥┤, ∞é╝, ...'">
  264.                 <!-- '∞¥╝, ∞¥┤, ∞é╝, ...' also seems: korean-counting -->
  265.                 <w:numFmt w:val="korean-digital"/>
  266.             </xsl:when>
  267.             <xsl:when test="$number-format = 'πä▒, πä┤, πä╖, ...' or $number-format = 'πëá, πëí, πëó, ...'">
  268.                 <!-- mapping circled to uncirled -->
  269.                 <w:numFmt w:val="chosung"/>
  270.             </xsl:when>
  271.             <xsl:when test="$number-format = 'Ω░Ç, δéÿ, δïñ, ...' or $number-format = 'πë«, πë», πë░, ...'">
  272.                 <!-- mapping circled to uncirled -->
  273.                 <w:numFmt w:val="ganada"/>
  274.             </xsl:when>
  275.             <xsl:when test="$number-format = '╪ú, ╪¿, ╪¬, ...'">
  276.                 <w:numFmt w:val="arabic-alpha"/>
  277.             </xsl:when>
  278.             <xsl:when test="$number-format = 'α╕ü, α╕é, α╕â, ...'">
  279.                 <w:numFmt w:val="thai-letters"/>
  280.             </xsl:when>
  281.             <xsl:when test="$number-format = '╫É, ╫æ, ╫Æ, ...'">
  282.                 <w:numFmt w:val="hebrew-1"/>
  283.             </xsl:when>
  284.             <xsl:when test="$number-format = 'Native Numbering'">
  285.                 <xsl:variable name="locale" select="/office:document/office:meta/dc:language"/>
  286.                 <xsl:choose>
  287.                     <xsl:when test="starts-with($locale, 'th-')">
  288.                         <!-- for Thai, mapping thai-numbers, thai-counting to thai-letters -->
  289.                         <w:numFmt w:val="thai-letters"/>
  290.                     </xsl:when>
  291.                     <xsl:when test="starts-with($locale, 'hi-')">
  292.                         <!-- for Hindi, mapping hindi-vowels, hindi-consonants, hindi-counting to hindi-numbers -->
  293.                         <w:numFmt w:val="hindi-numbers"/>
  294.                     </xsl:when>
  295.                     <xsl:when test="starts-with($locale, 'ar-')">
  296.                         <!-- for Arabic, mapping  arabic-abjad to arabic-alpha -->
  297.                         <w:numFmt w:val="arabic-alpha"/>
  298.                     </xsl:when>
  299.                     <xsl:when test="starts-with($locale, 'he-')">
  300.                         <!-- for Hebrew, mapping hebrew-2 to  -->
  301.                         <w:numFmt w:val="hebrew-1"/>
  302.                     </xsl:when>
  303.                     <xsl:when test="starts-with($locale, 'ru-')">
  304.                         <!-- for Russian, mapping russian-upper to russian-lower -->
  305.                         <w:numFmt w:val="russian-lower"/>
  306.                     </xsl:when>
  307.                     <xsl:when test="starts-with($locale, 'vi-')">
  308.                         <!-- for Vietnamese -->
  309.                         <w:numFmt w:val="vietnamese-counting"/>
  310.                     </xsl:when>
  311.                 </xsl:choose>
  312.             </xsl:when>
  313.             <!-- unsupported: ordinal, cardinal-text, ordinal-text, hex, chicago, bullet, ideograph-zodiac-traditional,
  314.             chinese-not-impl, korean-legal -->
  315.             <xsl:otherwise>
  316.                 <w:numFmt w:val="decimal"/>
  317.             </xsl:otherwise>
  318.         </xsl:choose>
  319.     </xsl:template>
  320. </xsl:stylesheet>
  321.